﻿using System;
using Shell.DomainDot;
using Framework.Poco;

namespace Framework.Domain
{
    public class UserContext : DomainDotBase<User>
    {
        public WithOne<Contact> Contact { private get; set; }

        public void Create(Contact instance)
        {
            var entity = this.Contact.Create();
            PocoUtils.AssignProperty<Contact>(instance, entity, typeof(Guid));
            if (String.IsNullOrWhiteSpace(entity.Name))
            {
                entity.Name = this.Main.Instance.Name;
            }
            this.Contact.Submit();
        }
    }
}
